﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BBPA.Admin.Sys.Setting
{
    public partial class Password : FormPage
    {
        BLL.PAUser bll = new BLL.PAUser();
        Model.PAUser model = new Model.PAUser();
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.formState = EnumHelper.FormState.edit;
            model = Security.GetCurrentUser();
        }
        /// <summary>
        /// 绑定表单数据【修改时用】
        /// </summary>
        public override void Form_Bind()
        {
            tb_Password_helper.Visible = true;
            //tb_Username.Text = DataTypePlus.requestString(model.Username);
        }
        /// <summary>
        /// 提交
        /// </summary>
        public override void Form_Submit()
        {
            //string Username = PageValidate.SqlTextClear(DataTypePlus.requestString(tb_Username.Text));
            //if (
            //    PageValidate.noEmpty(Username, "[用户名]必须填写") &&
            //    Master.noChongfu("Username='" + Username + "'", "[用户名]跟系统中其他用户名重复")
            //    )
            //{
                string Password = PageValidate.SqlTextClear(tb_Password.Text);
                //model.Username = Username;
                if (Password != "") model.Password = StringPlus.md5(Password);
                bll.Update(model);
                Security.CHKlogin(model.Username, model.Password);

                Master.SubmitOK();
            //}
        }
    }
}